package cn.iocoder.yudao.module.hs.dal.mysql.entryorder;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.hs.controller.admin.bigscreen.vo.WarehouseMaterialCount;
import cn.iocoder.yudao.module.hs.controller.admin.entryorder.vo.EntryOrderPageReqVO;
import cn.iocoder.yudao.module.hs.controller.admin.entryorder.vo.EntryOrderTrayRespVO;
import cn.iocoder.yudao.module.hs.controller.admin.trayscanrecord.vo.TrayScanRecordRespVO;
import cn.iocoder.yudao.module.hs.dal.dataobject.entryorder.EntryOrderDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 入库单 Mapper
 *
 * @author 航盛
 */
@Mapper
public interface EntryOrderMapper extends BaseMapperX<EntryOrderDO> {

    default PageResult<EntryOrderDO> selectPage(EntryOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EntryOrderDO>()
                .likeIfPresent(EntryOrderDO::getNo, reqVO.getNo())
                .eqIfPresent(EntryOrderDO::getWarehouseId, reqVO.getWarehouseId())
                .eqIfPresent(EntryOrderDO::getWarehouseType, reqVO.getWarehouseType())
                .eqIfPresent(EntryOrderDO::getOperator, reqVO.getOperator())
                .betweenIfPresent(EntryOrderDO::getEntryTime, reqVO.getEntryTime())
                .betweenIfPresent(EntryOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EntryOrderDO::getId));
    }

    List<WarehouseMaterialCount> getTripartiteMaterialChart();

    Integer getProductWarehouseHistoryCount(@Param("isToday") boolean isToday);

    List<EntryOrderTrayRespVO> getTrayList(@Param("shipOrderId") Long shipOrderId, @Param("warehouseId") Long warehouseId);
}